import { ListPage } from "custom/index";
import { getScriptManagePage } from './api'
import dayjs from 'dayjs'

import CommissionPageTableBefore from './PageTableBefore'
import TableBefore from './CommissionPageTableBefore.vue'
const tableBefore = new CommissionPageTableBefore('CommissionPageTableBefore')
tableBefore.setComponent(TableBefore)

const page = new ListPage('CommissionVerification');

page
  .api(getScriptManagePage)
  .autoFetch(false)
  .useSearch()
    .addInputItem('keyword', '花名/姓名/工号')
    .addDatePicker({ prop: 'month', label: '月份', type: 'month', format: "YYYY-MM", valueFormat: "YYYY-MM", clearable: false, default: dayjs().format('YYYY-MM') })
    .end()
  .useTable()
    .useIndexColumn().end()
    .useColumn('month').label('统计月份').minWidth(140).end()
    .useColumn('name').label('客服姓名').minWidth(140).end()
    .useColumn('flowerName').label('客服花名').minWidth(200).end()
    
    .useColumn('shopName').label('店铺名称').minWidth(200).end()
    // .useColumn('no').label('数据账号').minWidth(140).end()
    .useColumn('accountName').label('子账号名称').minWidth(140).end()
    .useColumn('customTypeName').label('客服类型').minWidth(200).end()
    .useColumn('platformName').label('平台').minWidth(200).end()
    .useColumn('baseSalary').label('分摊底薪').minWidth(140).end()
    .useColumn('startDate').label('开始日期').minWidth(140).end()
    .useColumn('endDate').label('结束日期').minWidth(140).end()
    .useColumn('workDays').label('工作天数').minWidth(140).end()
    .useColumn('baseProfit').label('底薪效益').minWidth(140).end()
    .useColumn('monthSalary').label('月销售额').minWidth(160).end()
    .useColumn('commissionRatio').label('提成比例 ').minWidth(140).end()
    .useColumn('commissionProfit').label('提成效益').minWidth(140).end()
    .useColumn('sumProfit').label('效益合计').minWidth(180).end()
    .end()
  .usePagination()
    .end()
  .useAuthButton()
    .useItem('export').content('导出数据').exportExcel().end()
    .end()
  .addChild(tableBefore, 'table-before')

export default page
